<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
</html>
<script !src="">
    let arr1 =[0,2,4,5,7]
    let arr2 = [0,3,5,6,8,4,9,55]
    var newarr = arr1 .filter((v) => arr2 .includes(v))
    //也可以用,不考虑(数组中不含NaN)
    newarr2 = arr1.filter((v)=> arr2.indexOf(v)>-1 )
    //filter方法是返回一个符合过滤条件的新数组，不改变原有的数组

    console.log(newarr)
    console.log(newarr2)


</script>
